package com.cbj.netty.handler;



import com.cbj.netty.protocol.PackageMsg;
import com.cbj.netty.rpc.ResponseCallBack;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * 此handler的重要用途就是当服务端返回结果时，调用runCallBack唤醒等待结果的线程
 */
public class ClientResponseHandler extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        // 服务端返回来的数据结果
        PackageMsg packageMsg = (PackageMsg) msg;
        ResponseCallBack.runCallBack(packageMsg);
    }
}